The problem is with
With local macros you cannot run lines separately. The local macros, whether initialized directly in the master do-file or in the -include-d header file, will not survive beyond the end of a block lines that are run separately. This is true of all local macros in Stata. If you initialize them in a group of lines (or single line) run separately, they will not be available for use after that.
If your master do-file is in a developmental state and you are trying to build it up in blocks, you must either:
1. Always run the entire do-file without interruption from beginning up to either its end or the point where you want it to stop while you are seeing what happens.
Or, if that is too time-consuming because the intervening code runs too long:
2. Comment out the intermediate code and then run the do file without interrupt from beginning to end (or stopping point).
But do not run groups of lines separately when local macros are being used.
after having run the first 3 lines separately
If your master do-file is in a developmental state and you are trying to build it up in blocks, you must either:
1. Always run the entire do-file without interruption from beginning up to either its end or the point where you want it to stop while you are seeing what happens.
Or, if that is too time-consuming because the intervening code runs too long:
2. Comment out the intermediate code and then run the do file without interrupt from beginning to end (or stopping point).
But do not run groups of lines separately when local macros are being used.
Comment